package com.neusoft.neu24.his.hisapp.dao.impl;

import com.neusoft.neu24.his.hisapp.dao.IMemberDao;
import com.neusoft.neu24.his.hisapp.entity.Member;

import java.util.ArrayList;
import java.util.List;

public class MemberDaoImpl implements IMemberDao {

    private static  final List<Member> Member_List = new ArrayList<>();
    static {
        Member_List.add(new Member("张三","zhangsan","123456","男"));
        Member_List.add(new Member("李四","lisi","123456","男"));
        Member_List.add(new Member("王五","wangwu","123456","女"));
        Member_List.add(new Member("赵六","zhaoliu","123456","男"));
        Member_List.add(new Member("孙七","sunqi","123456","女"));
        Member_List.add(new Member("周八","zhouba","123456","男"));
        Member_List.add(new Member("吴九","wujing","123456","女"));
        Member_List.add(new Member("郑十","zhengshi","123456","男"));
    }

    public List<Member> selectAll(){
        return   Member_List;
    }




    @Override
    public Member login(String logid, String password) {
        Member member = Member_List.stream().filter(m -> m.getLogid().equals(logid) && m.getPassword().equals(password)).findFirst().get();
//        .findFirst();

        return member;
    }
}
